home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / tools / indent.lha / indent / readme < prev    next >
Text File  |  1992-07-06  |  7KB  |  186 lines

  1. ---------------------------------------------------------------------
  2.  
  3. Indent is a C/C++ program formatter.  It reformats the C/C++ program
  4. in the input-file according to a long list of command line switches.
  5.  
  6. The original indent (from the University of Illinois and part of the
  7. Berkeley Software Distribution) was only for C programs.  It has since
  8. been modified to understand C++ syntax as well.
  9.  
  10. ---------------------------------------------------------------------
  11.  
  12.             A short guide to indent
  13.         (for impatient users of OS/2 or MSDOS)
  14.  
  15. Assuming you have managed to unpack the distribution sources and have
  16. compiled indent.exe:-
  17.  
  18. 1. Set up an environment variable called HOME pointing at some directory
  19.    where you keep useful things.  Copy indent.pro into that directory.
  20.    Alternatively put indent.pro somewhere along your DPATH or PATH.
  21.  
  22. 2. If you use a brain-damaged editor which doesn't allow tabs to be set
  23.    at any interval other than 8 columns, either change the line in
  24.    indent.pro which says
  25.     -tabs 4
  26.    or simply remove it altogether.
  27.  
  28. 3. Copy indent.exe to some directory on your PATH.
  29.  
  30. 4. Change directory to where your messy C or C++ programs reside.
  31.  
  32. 5. To clean up all the programs issue the command:
  33.     for %f in (*.c *.cpp) do indent %f
  34.  
  35. If you have an indent.pro in the current directory that will be processed
  36. after the one found in HOME or along DPATH or PATH.  This allows you to
  37. have options unique to a project without having to specify everything.
  38.  
  39. ---------------------------------------------------------------------
  40.  
  41.              An even shorter guide to indent
  42.         (for impatient users of BSD-flavoured UNIX)
  43.  
  44. Read the guide for OS/2-MSDOS and make the following changes:
  45.  
  46. 1. Copy indent.pro into your home directory or somewhere along your PATH,
  47.    calling it .indent.pro
  48.  
  49. 5. Use a loop syntax appropriate for your shell.
  50.  
  51. If you have a .indent.pro in the current directory that will be processed
  52. after the one found in your HOME directory or along your PATH.  This allows
  53. you to have options unique to a project without having to specify everything.
  54.  
  55. ---------------------------------------------------------------------
  56.  
  57.                       OS/2 implementor's note
  58.                       -----------------------
  59.  
  60. There seems to have been three streams of development for this program.
  61.  
  62. The original indent came from the University of Illinois where it was
  63. apparently written in 1976.  Some work was done by James Gosling and the
  64. people at Sun Microsystems.  The program became part of the BSD UNIX
  65. distribution at some time not later than 1985.  At around that time it was
  66. ported to MSDOS by Bruce Mallett and various fixes were done by Bruce
  67. Mallett and James Thompson.  James Thompson also implemented the handling
  68. of tabs at spacings other than 8 (surely a most worthwhile enhancement; who
  69. programs in C with tabs set at 8 anyway?)
  70.  
  71. While all this good stuff was going on, other (unnamed) people upgraded the
  72. original program to handle C++ syntax as well as ordinary C and apparently
  73. fixed a few minor annoyances which were extant in the version from which
  74. the MSDOS implementation was derived.
  75.  
  76. Then of course, the GNU project people of the Free Software Foundation have
  77. been doing things with sources apparently derived from the BSD version.
  78.  
  79. I have not looked at the GNU version of indent. I started with the BSD C++
  80. formatter sources from comp.misc.sources volume 21 and modified them for
  81. compilation with Microsoft C386 under OS/2 2.0.  That gave me a working
  82. baseline version to which I made the following modifications:
  83.  
  84. 1  Changed some of the file names to allow compilation with Microsoft C
  85.    version 6.00A which objects to files whose names do not conform to
  86.    MSDOS's 8.3 format.
  87.  
  88. 2  Built new makefiles for OS/2 2.0 and for OS/2 1.X.  (The MSDOS version
  89.    is created by post-processing the OS/2 1.X version.)
  90.  
  91.    Note that when you use Makefile.1x you'll see some warning messages
  92.    concerning the truncation of variable names.  You may safely ignore
  93.    them.  The messages do not appear when compiling the 32-bit version.
  94.  
  95. 2  Added James Thompson's tab stuff.
  96.  
  97. 3  Fixed a bug which was causing //-style comments to be followed by an
  98.    extra newline or an extra space depending on context.
  99.  
  100. 4  Corrected the stack overflow problem in the OS/2 1.x and MSDOS versions.
  101.    (This seems to have been independently discovered and fixed twice
  102.    previously but the sources contained no trace of the fix.)
  103.  
  104. 5  Patched the manual source to reflect the new -tabs option and generated
  105.    a human-readable version.
  106.  
  107. Finally, I put the sources through the indenter to clean up the mess.
  108.  
  109. More recently still, I built the program using the IBM C Set/2 tools after
  110. modifying the 2.0 Makefile.  I also:
  111.  
  112. 6  Fixed a bug notified by Steve Comen which was causing overlength //
  113.    comments to be split incorrectly.
  114.  
  115. 7  Modified the profile search to include DPATH under OS/2 and to include
  116.    PATH on all platforms.
  117.  
  118. 8  Modified the action of the -tabsN specifier.  If N is 2 or less then
  119.    indent will not use tab characters in the output.  This patch had the
  120.    side-effect of avoiding a potential divide-by-zero fault which would
  121.    have arisen if someone had said -tabs0.
  122.  
  123. Just before preparing the shar files for submission I removed all the tabs
  124. with the command:
  125.     for %f in (*.c *.h) do indent -tabs0 %f
  126.   
  127. Now, if I have done the job properly, the current source should combine both
  128. the BSD development streams.  Furthermore, it should compile under OS/2 1.x
  129. for OS/2 and MSDOS, under OS/2 2.0 for the 32-bit 'flat' model using either
  130. the Microsoft C386 compiler or the IBM C Set/2 compiler and on the original
  131. BSD UNIX platform.
  132.  
  133. I am indebted to Steve Comen and his colleagues for help with testing and
  134. verifying the BSD compatibility and for several patches.
  135.  
  136. Now all that remains to be done is to incorporate the nicer features of this
  137. version into the GNU one.  Any volunteers?
  138.  
  139. Jon Saxton
  140. April 1992
  141.  
  142. -------------------------------------------------------------------------
  143.  
  144. Manifest
  145.  
  146.     args.c        \
  147.     comment.c     \
  148.     indent.c      \_    Program source files
  149.     io.c          /
  150.     lexi.c         /
  151.     parse.c        /
  152.  
  153.     codes.h        \
  154.     globals.h     >-    Header files
  155.     proto.h        /
  156.  
  157.     indent.1        Manual source
  158.  
  159.     indent.man        Manual in human-readable form
  160.  
  161.     indent.def        Used only when compiling
  162.                 under OS/2 for OS/2 or MSDOS
  163.  
  164.     indent.pro        A sample profile (the one used to format
  165.                 these sources).  Rename to .indent.pro
  166.                 for use with BSD UNIX.
  167.  
  168.     Makefile.1x        Makefile for compiling under OS/2 1.x.
  169.                 Generates a bound 16-bit executable which
  170.                 will run under OS/2 or MSDOS.
  171.  
  172.     Makefile.20        Makefile for compiling under OS/2 2.0 using
  173.                 the IBM C Set/2 compiler.  Generates a 32-
  174.                 bit executable.
  175.  
  176.     Makefile.bsd        Untouched.  This is the original Makefile
  177.                 as distributed with the BSD version.
  178.  
  179.     readme            This file
  180.  
  181.     typedefs.os2        A collection of type names which may be
  182.                 useful for programming the OS/2 kernel.
  183.                 Simply add these to indent.pro or rename
  184.                 typedefs.os2 to indent.pro in the current
  185.                 directory.
  186.